package turing.forum.config.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@ConfigurationProperties(prefix = "forum.upload")
public class UploadProperties {
    private String path;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        if (path.startsWith("classpath:")) {
            String tmp = UploadProperties.class.getClassLoader().getResource("").getPath();
            tmp = tmp + path.split("classpath:")[1] + "/";
            path = tmp;
        }
        this.path = path;
    }
}
